import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ResourcesPublicVO, ResourcesPublicForm, ResourcesPublicQuery } from '@/api/core/resourcesPublic/types';

/**
 * 查询教学资源管理公有库列表
 * @param query
 * @returns {*}
 */

export const listResourcesPublic = (query?: ResourcesPublicQuery): AxiosPromise<ResourcesPublicVO[]> => {
  return request({
    url: '/core/resourcesPublic/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询教学资源管理公有库详细
 * @param id
 */
export const getResourcesPublic = (id: string | number): AxiosPromise<ResourcesPublicVO> => {
  return request({
    url: '/core/resourcesPublic/' + id,
    method: 'get'
  });
};

/**
 * 新增教学资源管理公有库
 * @param data
 */
export const addResourcesPublic = (data: ResourcesPublicForm) => {
  return request({
    url: '/core/resourcesPublic',
    method: 'post',
    data: data
  });
};

/**
 * 修改教学资源管理公有库
 * @param data
 */
export const updateResourcesPublic = (data: ResourcesPublicForm) => {
  return request({
    url: '/core/resourcesPublic',
    method: 'put',
    data: data
  });
};

/**
 * 删除教学资源管理公有库
 * @param id
 */
export const delResourcesPublic = (id: string | number | Array<string | number>) => {
  return request({
    url: '/core/resourcesPublic/' + id,
    method: 'delete'
  });
};
